{st:comment action="get_count" typeid="5" articleid="$info['id']" return="count"}
<div class="content-detail-discuss" id="md-sppl">
    <h3 id="lineZX" class="content-detail-title clearfix">商品评论
        <ul class="ul clearfix">
            <li class="on" data-flag="all">全部 ({$count['total']})</li>
            <li data-flag="pic">有图 ({$count['picnum']})</li>
            <li data-flag="well">好评 ({$count['wellnum']})</li>
            <li data-flag="mid">中评 ({$count['midnum']})</li>
            <li data-flag="bad">差评 ({$count['badnum']})</li>
        </ul>
        {if ($GLOBALS['cfg_satisfy']==1)}
        <p class="level fr"><span class="t">满意度</span><span class="t-ff0036">{trim($count['satisfyscore'],'%')}<i>%</i></span></p>
        {/if}
    </h3>
    <div class="content">
        <ul id="comment_list">
        </ul>
        <div id="page-list" class="page-list"></div>
    </div>
</div>
<script>
    $(function(){
        //获取第一页评论
        get_comment_list(1);
        $("#lineZX ul li").click(function(){
            $(this).addClass('on').siblings().removeClass('on');
            get_comment_list(1);
        });

        //获取评论列表
        function get_comment_list(pageno)
        {
            var flag = $("#lineZX ul li.on").attr("data-flag");
            $.ajax({
                type:'POST',
                aysnc:true,
                url:SITEURL+'ferry/ajax_get_pinlun',
                data:{
                    flag:flag,
                    articleid:{$info['id']},
                    pageno:pageno
                },
                dataType:'json',
                success:function(data){

                    var html = "";
                    if(data.list.length>0){
                        for(var i=0;i<data.list.length;i++)
                        {
                            var row = data.list[i];
                            html += '<li class="clearfix">';
                            html += ' <div class="discuss-left fl clearfix">';
                            html += '<div class="img-user fl"><img width="50" height="50" src="'+row['litpic']+'" alt="'+row['nickname']+'"></div>';
                            html += '<div class="user-info">';
                            html += '<p>'+row['nickname']+'</p>';
                            html += ' <p>'+row['level']+'</p>';
                            html += '</div>';
                            html += '</div>';
                            html += ' <div class="discuss-right">';
                            html += '<div class="graded">';
                            var star_num=1
                            var rank = parseInt(row['rank']);
                            for(;star_num<=rank;star_num++)
                            {
                                html += '<i></i>';
                            }
                            html += '</div>';
                            html += '<div class="discuss-t">'+row['content']+'</div>';
                            html += '<div class="discuss-img">';

                            for(var pic_index=0; pic_index<row['piclist'].length;pic_index++)
                            {
                                if(row['piclist'][pic_index])
                                {
                                    html += '<a class="fancybox" href="' + row['piclist'][pic_index] + '"><img src="' + row['picthumb'][pic_index] + '" alt=""></a>';
                                }
                            }
                            html += '</div>';
                            html += '<div class="commodity-name">';
                            html += row['suit_name'] && row['suit_name'].length>0?'<span class="comment_suit_name">'+row['suit_name']+'</span>':'';
                            html +='<span>'+row['addtime']+'</span></div>';
                            html += '</div>';
                            html += '</li>';
                        }

                        $("#comment_list").html(html);
                        //弹出相册
                        $('.fancybox').fancybox();
                        gen_pager(data.total,data.pageno,data.pagesize)
                    }
                    else
                    {
                        $("#page-list").html('');
                        $("#comment_list").html('');
                        //$(".main_mod_page").html('');
                    }
                }
            })
        }

        function gen_pager(total,page,pagesize)
        {
            var page_num = Math.ceil(total/pagesize);
            laypage({
                cont: 'page-list',
                pages: page_num,
                curr: page,
                skip: true,
                skin: '#2dbb55', //皮肤
                groups: 3,
                first: '首页',
                last: '尾页',
                prev: '上一页',
                next: '下一页',
                jump: function (obj, first) {
                    //得到了当前页，用于向服务端请求对应数据
                    var curr = obj.curr;
                    if (!first) {
                        get_comment_list(curr);
                    }
                }
            });
        }
    });

</script>